package com.lagou.edu.controller;

import com.lagou.edu.pojo.LoginUser;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/login")
public class LoginController {

    @RequestMapping("/")
    public String login(HttpServletRequest request, LoginUser user) {
        if ("admin".equals(user.getUsername()) && "admin".equals(user.getPassword())){
            HttpSession session = request.getSession();
            session.setAttribute("login","admin");
            return "forward:/resume/list";
        }
        return "login";
    }

}
